<?php
defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('exercise.stylesheet');
$canDo = ExercisesHelper::getActions();
$user = JFactory::getUser();
$userId = $user->get('id');
?>
<script type="text/javascript">
    Joomla.submitbutton = function(task)
    {
        if (task == 'answer.cancel' || document.formvalidator.isValid(document.id('answer-form'))) {
            Joomla.submitform(task, document.getElementById('answer-form'));
        }
    }
</script>

<form action="<?php echo JRoute::_('index.php?option=com_exercises&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="answer-form" class="form-validate">

    <?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>
    <div class="form-horizontal">
        <?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>

        <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', JText::_('COM_EXERCISES_GROUP_LABEL_PUBLISHING_DETAILS', true)); ?>
        <div class="row-fluid">
            <div class="span9">

                <?php echo $this->form->getControlGroup('ques_id'); ?>                
                <?php echo $this->form->getControlGroup('point'); ?>                
                <?php echo $this->form->getControlGroup('answer'); ?>
            </div>
            <div class="span3">
                <?php echo JLayoutHelper::render('joomla.edit.global', $this); ?>
            </div>
        </div>
        <?php echo JHtml::_('bootstrap.endTab'); ?>
        <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', JText::_('JGLOBAL_FIELDSET_PUBLISHING', true)); ?>
        <div class="row-fluid form-horizontal-desktop">
            <div class="span6">
                <?php echo JLayoutHelper::render('joomla.edit.publishingdata', $this); ?>
            </div>
            <div class="span6">
                <?php echo $this->form->getControlGroups('metadata'); ?>
            </div>
        </div>
        <?php echo JHtml::_('bootstrap.endTab'); ?>

        <?php echo JHtml::_('bootstrap.endTabSet'); ?>
    </div>

    <input type="hidden" name="task" value="" />
    <?php echo JHtml::_('form.token'); ?>
</form>